<link rel="stylesheet" href="/assets/plugins/layui/css/layui.css?v={$version}"/>
<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <div class="widget-head am-cf">
                    <div class="widget-title am-cf">添加商家</div>
                </div>
                <form id="my-form" class="am-form tpl-form-line-form" method="post">
                    <div class="widget-body">
                        <fieldset>
                        <div class="am-form-group">
                            <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require"> 商家名称 </label>
                            <div class="am-u-sm-9 am-u-end">
                                <input type="text" class="tpl-form-input" name="data[shop_name]"
                                       placeholder="请输入商家名称" required>
                            </div>
                        </div>
                        <div class="am-form-group">
                            <label class="am-u-sm-3 am-u-lg-2 am-form-label"> 图片资质 </label>
                            <div class="am-u-sm-9 am-u-end">   
                            <div class="am-form-file fl">
                                <button type="button" class="upload-file am-btn am-btn-secondary am-radius">
                                        <i class="am-icon-cloud-upload"></i> 门店图标
                                </button>
                                <div class="uploader-list am-cf"></div>
                            </div>
                            <div class="am-form-file fl">
                                <button type="button"
                                        class="upload-file hema-business am-btn am-btn-secondary am-radius">
                                    <i class="am-icon-cloud-upload"></i> 营业执照
                                </button>
                                <div class="uploader-list am-cf"></div>
                            </div>
                            <div class="am-form-file fl">
                                <button type="button"
                                        class="upload-file hema-license am-btn am-btn-secondary am-radius">
                                    <i class="am-icon-cloud-upload"></i> 食品经营许可证
                                </button>
                                <div class="uploader-list am-cf"></div>
                            </div>
                        </div>
                        <div class="am-form-group am-padding-top">
                            <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require"> 联系人 </label>
                            <div class="am-u-sm-9 am-u-end">
                                <input type="text" class="tpl-form-input" name="data[linkman]"
                                       placeholder="请输入商家联系人" required>
                            </div>
                        </div>
                        <div class="am-form-group">
                            <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require"> 联系电话 </label>
                            <div class="am-u-sm-9 am-u-end">
                                <input type="text" class="tpl-form-input" name="data[phone]"
                                       placeholder="请输入商家联系电话" required>
                            </div>
                        </div>
                        <div class="am-form-group">
                            <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require"> 营业时间 </label>
                            <div class="am-u-sm-9 am-u-end">
                                <input type="text" id="shop_hours" class="tpl-form-input" name="data[shop_hours]" placeholder="请选择营业时间" required>
                            </div>
                        </div>
                        <div class="am-form-group">
                            <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require"> 详细地址 </label>
                            <div class="am-u-sm-9 am-u-end">
                                <input type="text" class="tpl-form-input" name="data[address]"
                                       placeholder="请输入详细地址" required>
								<small>不用填写省、市、区</small>
                            </div>
                        </div>
                        <div class="am-form-group">
                            <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require"> 商家坐标 </label>
                            <div class="am-u-sm-9 am-u-end">
                                <div class="am-block">
                                    <input type="text" style="background: none !important;" id="coordinate"
                                           class="tpl-form-input" name="data[coordinate]"
                                           placeholder="请选择商家坐标" readonly="" required>
                                </div>
                                <div class="am-block am-padding-top-xs">
                                    <iframe id="map" src="{:url('shop/getpoint')}" width="915" height="610"></iframe>
                                </div>
                            </div>
                        </div>
                        <div class="am-form-group">
                            <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require"> 外卖状态 </label>
                            <div class="am-u-sm-9 am-u-end">
                                <label class="am-radio-inline">
                                    <input type="radio" name="data[is_takeout]" value="1" data-am-ucheck>
                                    开启
                                </label>
                                <label class="am-radio-inline">
                                    <input type="radio" name="data[is_takeout]" value="0" checked data-am-ucheck>
                                    关闭
                                </label>
                            </div>
                        </div>
                        <div class="am-form-group">
                            <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require"> 营业状态 </label>
                            <div class="am-u-sm-9 am-u-end">
                                <label class="am-radio-inline">
                                    <input type="radio" name="data[status]" value="1" data-am-ucheck
                                           checked>
                                    营业中
                                </label>
                                <label class="am-radio-inline">
                                    <input type="radio" name="data[status]" value="0" data-am-ucheck>
                                    歇业中
                                </label>
                            </div>
                        </div>
                        <div class="am-form-group">
                            <div class="am-u-sm-9 am-u-sm-push-3 am-margin-top-lg">
                                <button type="submit" class="j-submit am-btn am-btn-secondary">提交
                                </button>
                            </div>
                        </div>
                        </fieldset>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<!-- 图片文件列表模板 -->
{include file="../addons/upload/view/template/tpl_file_item_path.html" /}
<!-- 文件库弹窗 -->
{include file="../addons/upload/view/template/file_library.html" /}
<script src="/assets/plugins/layui/layui.js?v={$version}" charset="utf-8"></script>
<script>
    layui.use('laydate', function(){
      var laydate = layui.laydate;
      //时间范围
      laydate.render({
        elem: '#shop_hours'
        ,format: 'HH:mm'
        ,type: 'time'
        ,range: true
      });
    });
    /**
     * 设置坐标
     */
    function setCoordinate(value) {
        var $coordinate = $('#coordinate');
        $coordinate.val(value);
        // 触发验证
        $coordinate.trigger('change');
    }
	
    $(function () {
        // 选择图片
        $('.upload-file').selectImages({
            name: 'data[logo]'
        });
        $('.hema-business').selectImages({
            name: 'data[business]'
        });
        $('.hema-license').selectImages({
            name: 'data[license]'
        });
        $('#my-form').formPost();
    });
</script>